/*
 * @Author: 来自火星的码农 15122322+heyzhi@user.noreply.gitee.com
 * @Date: 2025-10-12 16:45:24
 * @LastEditors: 来自火星的码农 15122322+heyzhi@user.noreply.gitee.com
 * @LastEditTime: 2025-10-30 15:14:03
 * @FilePath: /GateServer/src/entity/user.h
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE   
 */
#pragma once
#include <jsoncpp/json/value.h>
namespace Yizhi {
    class User{
        public:
        
        User()=default;
        explicit User(const Json::Value &data);
        void setUsername(const std::string &name){ m_username=name;}
        void setEmail(const std::string &email){m_email=email;}
        void setPassword(const std::string &psw){m_password=psw;}
        void setRePsw(const std::string &repsw){m_repsw=repsw;}
        void setVarifyCode(int code){m_varify_code=std::to_string(code);}
        void setUid(int uid){m_uid=uid;}
        const std::string& getVarifycode() const {return m_varify_code;}
        const  std::string& getUsername() const{return m_username;}
        const std::string& getEmail()const{return m_email;}
        const std::string& getPassword()const {return m_password;}
        const std::string& getRePsw()const{return  m_repsw;}
        const int& getUid()const{return m_uid;}

        std::string toJsonstring() const;
        bool validate() const;
        bool validatewithoutpsw()const;
        bool validatewithoutusername()const;
        bool validatewithoutemail()const;


        Json::Value toJson() const;
        void serializeFields(Json::Value& json) const;

        
        private:
        int m_uid;
        std::string m_username;
        std::string m_email;
        std::string m_password;
        std::string m_repsw;
        std::string  m_varify_code;
    };
}